﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

   <Style x:Key="ButtonFocusVisual">
      <Setter Property="Control.Template">
         <Setter.Value>
            <ControlTemplate>
               <Rectangle Margin="2"
                          SnapsToDevicePixels="true"
                          Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
                          StrokeThickness="1"
                          StrokeDashArray="1 2" />
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

   <Style TargetType="{x:Type Button}">
      <Setter Property="FontSize"
              Value="14" />
      <Setter Property="FontFamily"
              Value="Segoe UI" />
      <Setter Property="Foreground"
              Value="White" />
      <Setter Property="Padding"
              Value="3" />
      <Setter Property="BorderThickness"
              Value="0" />
      <Setter Property="FocusVisualStyle"
              Value="{x:Null}" />
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">
               <Grid UseLayoutRounding="True">
                  <VisualStateManager.VisualStateGroups>
                     <VisualStateGroup x:Name="FocusStates">
                        <VisualState x:Name="Focused">
                           <Storyboard>
                              <DoubleAnimation Duration="0"
                                               Storyboard.TargetName="FocusVisualElement"
                                               Storyboard.TargetProperty="Opacity"
                                               To="1" />
                           </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Unfocused" />
                     </VisualStateGroup>
                  </VisualStateManager.VisualStateGroups>
                  <Border Background="{DynamicResource NormalBrush}"
                          Padding="{TemplateBinding Padding}"
                          CornerRadius="5"
                          x:Name="PART_MainBackground">
                        <Grid Margin="10,3"
                              x:Name="PART_Content"
                              UseLayoutRounding="True"
                              HorizontalAlignment="Center">
                           <ContentPresenter Content="{TemplateBinding Content}"
                                             x:Name="PART_ContentText"
                                             VerticalAlignment="Center" />
                        </Grid>
                  </Border>
                  <Border BorderBrush="{DynamicResource MainBorderBrush}"
                          BorderThickness="{TemplateBinding BorderThickness}"
                          CornerRadius="5"
                          x:Name="PART_MainBorder" />
                  <Rectangle Margin="2"
                             Opacity="0"
                             SnapsToDevicePixels="true"
                             x:Name="FocusVisualElement"
                             Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
                             StrokeThickness="1"
                             StrokeDashArray="1 2" />
               </Grid>
               <ControlTemplate.Triggers>

                  <Trigger Property="IsMouseOver"
                           Value="True">
                     <Setter TargetName="PART_MainBackground"
                             Property="Background"
                             Value="{DynamicResource NormalHoverBrush}" />
                  </Trigger>

                  <Trigger Property="IsPressed"
                           Value="True">
                     <Setter TargetName="PART_MainBackground"
                             Property="Background"
                             Value="{DynamicResource NormalClickBrush}" />
                     <Setter TargetName="PART_Content"
                             Property="Margin"
                             Value="11,4,9,2" />
                  </Trigger>

                  <Trigger Property="IsEnabled"
                           Value="false">
                     <Setter Property="Foreground"
                             Value="{DynamicResource DisabledForegroundBrush}" />
                     <Setter TargetName="PART_MainBackground"
                             Property="Background"
                             Value="{DynamicResource DisabledBackgroundBrush}" />
                     <Setter Property="BorderThickness"
                             Value="1" />
                     <Setter Property="FontWeight"
                             Value="Normal" />
                  </Trigger>
               </ControlTemplate.Triggers>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

</ResourceDictionary>